package com.provider.provider.rabitmq;

import com.redlight.rabbitmq.RabbitConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

/**
 * Created by chao on 2019/3/29.
 */

@RabbitListener(queues = RabbitConfig.QUEUE_A)
public class MsgReceiver implements MessageListener {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @RabbitHandler
    public void process(String content) {
        System.out.println("hahha"+content);
        logger.info("接收处理队列A当中的消息： " + content);
    }

    @Override
    public void onMessage(Message message) {

    }

    @Override
    public void containerAckMode(AcknowledgeMode mode) {

        System.out.println( mode.isAutoAck());
    }
}
